package de.szut.scene.scenes;

import org.andengine.engine.camera.Camera;
import org.andengine.entity.sprite.Sprite;
import org.andengine.opengl.util.GLState;

import de.szut.scene.helper.BaseScene;
import de.szut.scene.helper.SceneType;
import de.szut.util.Settings;

/**
 * Created by dzebcuks on 22.08.13.
 */
public class SplashScene extends BaseScene {

    private Sprite splash;

    @Override
    public void createScene() {
        this.splash = new Sprite(0, 0, this.resourcesManager.getSplashRegion(), vbom) {
            @Override
            protected void preDraw(GLState pGLState, Camera pCamera) {
                super.preDraw(pGLState, pCamera);
                pGLState.enableDither();
            }
        };

        splash.setScale(2.5f);
//        splash.setPosition(Settings.RESOLUTION_WIDTH/2,Settings.RESOLUTION_HEIGHT/2);
        splash.setPosition((Settings.RESOLUTION_WIDTH * 0.5f) - (splash.getWidth() * 0.5f), (Settings.RESOLUTION_HEIGHT * 0.5f) - (splash.getHeight() * 0.5f));
        attachChild(splash);


    }

    @Override
    public void onBackKeyPressed() {

    }

    @Override
    public SceneType getSceneType() {
        return SceneType.SCENE_SPLASH;
    }

    @Override
    public void disposeScene() {
        splash.detachSelf();
        splash.dispose();
        this.detachSelf();
        this.dispose();
    }
}
